package com.wwwc.admin.web.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.SQLException;

import com.wwwc.admin.web.database.*;
import com.wwwc.util.web.*;

public class TopBarBean {

    public StringBuffer listDatabases(ResourceBundle SystemInfo, String form_call_back, String action) {
	StringBuffer sbf = new StringBuffer();
	String databases =  SystemInfo.getString("3wcenter.databases");

	sbf.append("<TABLE border='1'  cellSpacing='0' cellPadding='2' style='font-size: 10pt' width='100%'>");
	sbf.append("<TR><TD>Database</TD><TD>URL</TD><TD>Driver</TD><TD>&nbsp;</TD></TR>");

	StringTokenizer tokens = new StringTokenizer(databases, ",");
	String temp = null;

	while (tokens.hasMoreTokens()) {
	    temp = tokens.nextToken();
	    sbf.append("<FORM method=post action='"+form_call_back+"'>");
	    sbf.append("<TR><TD>"+temp+"</TD>");
	    sbf.append("<TD>"+SystemInfo.getString("3wcenter.database."+temp+".db_name")+"</TD>");
	    sbf.append("<TD>"+SystemInfo.getString("3wcenter.database."+temp+".driver_name")+"</TD>");
	    sbf.append("<TD align=center><input type=submit value=Continue style='font-size: 8pt'></TD></TR>");
	    sbf.append("<input type=hidden name=action value='"+action+"'>");
	    sbf.append("<input type=hidden name=database value="+temp+">");
	    sbf.append("<input type=hidden name=mid value=1>");
	    sbf.append("<input type=hidden name=lid value=1>");
	    sbf.append("</FORM>");
	}

	sbf.append("<FORM method=post action='"+form_call_back+"'>");
	sbf.append("<TR><TD>");
	sbf.append("<TD align=center><input type=submit value=Test1 style='font-size: 8pt'></TD></TR>");
	sbf.append("<input type=hidden name=tid value='1'>");
	sbf.append("<input type=hidden name=taid value='1'>");
	sbf.append("<input type=hidden name=mid value='1'>");
	sbf.append("<input type=hidden name=maid value='1'>");
	sbf.append("</FORM>");
	sbf.append("</TABLE>");
	return sbf;
    }
}
